home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / June 96 / BUG Rendering Icons < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  2.3 KB  |  [TEXT/ttxt]

  1. Subject:     BUG: Rendering Icons
  2. Sent:        6/26/96 2:05 PM
  3. Received:    6/26/96 2:11 PM
  4. From:        Mike O'Connor, lepton@panix.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. I think it is a bug that FW_CIconShape::RenderIcon does not always honor 
  9. the rect it is given for drawing.
  10.  
  11. I start with a handle to an IconSuite, which I get by asking a Cyberdog 
  12. CyberItem. In other words, I can't supply a file and resourceID, I must 
  13. start with a handle to an icon suite. Then I make a FW_CIcon from that.
  14.  
  15. The problem is that when you give the FW_CIcon constructor a handle to an 
  16. icon suite, it computes the size of the icon by going through all the 
  17. icons in the suite and finding the BIGGEST size icon in the suite. Thus, 
  18. if you have a suite with both 16x16 and 32x32 icons, it is considered a 
  19. 32x32 icon.
  20.  
  21. This is different from making an FW_CIcon by supplying a resource file 
  22. and ID to the constructor, because in that method, you can specify a size 
  23. parameter which explicitly tells it which size icon you are interested in.
  24.  
  25. Now, when I use RenderIcon in this FW_CIcon, it uses the size of the 
  26. FW_CIcon to determine the size of the icon it will draw. I am supplying 
  27. the method with a 16x16 rect to draw in, but this is overridden, as it 
  28. thinks the icon itself is 32x32 and it draws a 32x32 icon with its 
  29. topleft in the right place, but it blasts a 32x32 icon on the canvas.
  30.  
  31. Peeping at the sources, I believe there are several places you might fix 
  32. this. I would like to suggest adding an optional size parameter to the 
  33. FW_CIcon constructor which accepts a FW_PlatformIcon. This breaks 
  34. nothing, and could save a little memory by not loading unnecessary icons. 
  35. IT doesn't solve the whole problem though. To do that, the Rendering of 
  36. an icon should honor the size of the rect supplied it. If a 16x16 rect is 
  37. given, it should draw a 16x16 icon. No way should it draw anything 
  38. outside the rect, as it does now.
  39.  
  40. By the way, I worked around this bug by going through the suite, removing 
  41. any 32x32 icons within it, and then passing it to the FW_CIcon 
  42. constructor. This was the only way I could draw a 16x16 icon from a suite 
  43. which might contain 32x32 versions. It is not a perfect workaround 
  44. because I am assuming the suite I'm given has at least one 16x16 icon in 
  45. it.
  46.  
  47. -Mike
  48.